package com.threeti.jiayusms.interfaces.ws.communicationlog;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.threeti.jiayusms.domain.model.legacy.CommunicationLog;
import com.threeti.jiayusms.domain.service.communicationlog.CommunicationLogQueryService;
import com.threeti.jiayusms.interfaces.ws.communicationfunction.CommunicationFunctionDto;

@WebService(serviceName = "LogTemplateService", portName = "LogTemplateServicePort", 
		endpointInterface = "com.threeti.jiayusms.interfaces.ws.communicationlog.LogTemplateWebService", 
		targetNamespace = "http://127.0.0.1:8080/sms-maintenance-main" )
@Transactional
public class LogTemplateWebServiceDelegate implements LogTemplateWebService {

	@Autowired
	private CommunicationLogQueryService queryService;
	
	@Override
	public CommunicationLogDto findCommunicationLogBy(Long logId) {
		CommunicationLog logTemplate = queryService.findCommunicationLogBy(logId);
		
		if(logTemplate == null){
			return null;
		}
		CommunicationLogDto dto = new CommunicationLogDto(
				logTemplate.getCommunicationDate(),
				logTemplate.getClientName(),
				logTemplate.getTruckId(),
				logTemplate.getCarryId(),
				logTemplate.getCommunicationMode(),
				logTemplate.getCommunicationNumber(),
				logTemplate.getCommunicationContent(),
				logTemplate.getCommunicationFlag(),
				logTemplate.getCommunicationTime(),
				logTemplate.getBdepartment(),
				logTemplate.getActiveFlag());
		
		return dto;
	}
	
	@Override
	public List<CommunicationLogDto> findCommunicationLogByList(){
		List<CommunicationLogDto> dto = new ArrayList<CommunicationLogDto>();
		
		return dto;
	}
	
}
